
function nb = neighb(X)

% spending in neighboring districts
nb = zeros(size(X));

% Ags 1: Zac 2,4, Jal 2, Ags 2,3
nb(1,:) = mean(X([2,3,143,257,300],:),1);
% Ags 2-3: Jal 2, Ags 1,2,3
for d = 2:3
    nb(d,:) = mean(X([1,5-d,143],:),1);
end
% BCS 1: Son 1, BCS 2
nb(4,:) = mean(X([5,84],:),1);
% BCS 2: BCS 1
nb(5,:) = X(4,:);
% Camp 1: Camp 2, QR 2, Yuc 5
nb(6,:) = mean(X([260,224,255],:),1);
% Coah 1: Coah 2,3, NL 12
nb(7,:) = mean(X([8,9,208],:),1);
% Coah 2: Coah 1,3,5, Chih 5, Dgo 2,3
nb(8,:) = mean(X([7,9,11,21,27,28],:),1);
% Coah 3: Coah 1,2,4,5,7, NL 1,9,12
nb(9,:) = mean(X([7,8,10,11,13,289,206,208],:),1);
% Coah 4: Coah 3,7, NL 9, Zac 3
nb(10,:) = mean(X([9,13,206,299],:),1);
% Coah 5: Coah 3,6,7, Dgo 2,3, Zac 3
nb(11,:) = mean(X([9,12,13,27,28,299],:),1);
% Coah 6: Coah 5, Dgo 2
nb(12,:) = mean(X([11,27],:),1);
% Coah 7: Coah 3,4,5, Zac 3
nb(13,:) = mean(X([9,10,11,299],:),1);
% Chis 3: Chis 1,2,5,8
nb(14,:) = mean(X([261,110,112,15],:),1);
% Chis 8: Chis 3,5,6,10,11
nb(15,:) = mean(X([14,112,113,16,115],:),1);
% Chis 10: Chis 4,6,7,8,11, Oax 7
nb(16,:) = mean(X([111,113,114,15,115,63],:),1);
% Chih 1: Chih 2,3,4,5,7,8, Son 2,4
nb(17,:) = mean(X([18:21,23,24,85,87],:),1);
% Chih 2-4: Chih 1-4
for d = 18:20
    nb(d,:) = mean(X(setdiff(17:20,d),:),1);
end
% Chih 5: Chih 1,6,8,9, Coah 2, Dgo 3
nb(21,:) = mean(X([17,22,24,25,8,28],:),1);
% Chih 6: Chih 5,7,8,9
nb(22,:) = mean(X([21,23:25],:),1);
% Chih 7: Chih 1,6,8,9, Son 4,7
nb(23,:) = mean(X([17,22,24,25,87,90],:),1);
% Chih 8: Chih 1,5,6,7
nb(24,:) = mean(X([17,21:23],:),1);
% Chih 9: Chih 5,6,7, Son 7, Sin 1, Dgo 1,3
nb(25,:) = mean(X([21:23,90,76,26,28],:),1);
% Dgo 1: Dgo 3,4, Chih 9, Sin 1,5,6, Nay 1, Zac 1,2
nb(26,:) = mean(X([28,29,25,76,80,81,54,256,257],:),1);
% Dgo 2: Dgo 3, Coah 2,5,6
nb(27,:) = mean(X([28,8,11,12],:),1);
% Dgo 3: Dgo 1,2,4, Chih 5,9, Coah 2,5, Zac 1,3
nb(28,:) = mean(X([26,27,29,21,25,8,11,256,299],:),1);
% Dgo 4: Dgo 1,3
nb(29,:) = mean(X([26,28],:),1);
% Gro 1: Gro 2,3,6,7, Mich 3,11, Mex 36
nb(30,:) = mean(X([31,32,34,35,46,52,189],:),1);
% Gro 2: Gro 1,6, Mex 36,40, Mor 4
nb(31,:) = mean(X([30,34,189,193,198],:),1);
% Gro 3: Gro 1,7, Mich 1
nb(32,:) = mean(X([30,35,44],:),1);
% Gro 5: Gro 6,7,8, Oax 6,11
nb(33,:) = mean(X([34:36,62,67],:),1);
% Gro 6: Gro 1,2,5,7, Mor 4, Pue 14, Oax 6
nb(34,:) = mean(X([30,31,33,35,198,221,62],:),1);
% Gro 7: Gro 1,3,4,5,6,8
nb(35,:) = mean(X([30,32,280,33,34,36],:),1);
% Gro 8: Gro 4,5,7,9, Oax 11
nb(36,:) = mean(X([280,33,35,141,67],:),1);
% Hgo 1: Hgo 2,3, SLP 7, Ver 1,2
nb(37,:) = mean(X([38,39,75,233,234],:),1);
% Hgo 2: Hgo 1,3,5, Qro 1, SLP 7
nb(38,:) = mean(X([37,39,41,69,75],:),1);
% Hgo 3: Hgo 1,2,4,5,6,7, Mex 2, Ver 2
nb(39,:) = mean(X([37,38,40,41:43,157,234],:),1);
% Hgo 4: Hgo 3,6,7, Ver 2, Pue 1,2
nb(40,:) = mean(X([39,42,43,234,209,210],:),1);
% Hgo 5: Hgo 2,3, Mex 1,2, Qro 2
nb(41,:) = mean(X([38,39,285,157,293],:),1);
% Hgo 6: Hgo 3,4,7
nb(42,:) = mean(X([39,40,43],:),1);
% Hgo 7: Hgo 3,4,6, Pue 2, Mex 5,28, Tlax 1,3
nb(43,:) = mean(X([39,40,42,210,160,181,99,101],:),1);
% Mich 1: Mich 9,11,12, Gro 3
nb(44,:) = mean(X([51:53,32],:),1);
% Mich 2: Mich 3,5,6,7,8,10, Gto 10,11,13,14
nb(45,:) = mean(X([46,48:50,194,288,278,138:140],:),1);
% Mich 3: Mich 2,6,10,11, Mex 3,23,36, Gro 1
nb(46,:) = mean(X([45,49,288,52,158,176,189,30],:),1);
% Mich 4: Mich 5,7,12, Jal 15,17,19
nb(47,:) = mean(X([48,50,53,153,155,156],:),1);
% Mich 5: Mich 2,4,7, Jal 15, Gto 11
nb(48,:) = mean(X([45,47,50,153,138],:),1);
% Mich 6: Mich 2,3, Gto 14, Qro 2, Mex 3
nb(49,:) = mean(X([45,46,140,293,158],:),1);
% Mich 7: Mich 2,4,5,8,9,11,12, Jal 19
nb(50,:) = mean(X([45,47,48,194,51:53,156],:),1);
% Mich 9: Mich 1,7,11,12
nb(51,:) = mean(X([44,50,52,53],:),1);
% Mich 11: Mich 1,3,7,8,9,10, Gro 1
nb(52,:) = mean(X([44,46,50,194,51,288,30],:),1);
% Mich 12: Mich 1,7,9, Jal 19, Col 1,2
nb(53,:) = mean(X([44,50,51,156,108,109],:),1);
% Nay 1: Nay 2,3, Sin 6, Dgo 1, Jal 1, Zac 2
nb(54,:) = mean(X([55,56,81,26,142,257],:),1);
% Nay 2: Nay 1,3
nb(55,:) = mean(X([54,56],:),1);
% Nay 3: Nay 1,2, Jal 1,5,18
nb(56,:) = mean(X([54,55,142,145,284],:),1);
% Oax 1: Oax 2,4,7, Ver 17,18,20
nb(57,:) = mean(X([58,60,63,246,247,249],:),1);
% Oax 2: Oax 1,3,4, Pue 16, Ver 18
nb(58,:) = mean(X([57,59,60,68,247],:),1);
% Oax 3: Oax 2,4,6,8,9, Pue 14,16
nb(59,:) = mean(X([58,60,62,64,65,221,68],:),1);
% Oax 4: Oax 1,2,3,5,7,8,9,10
nb(60,:) = mean(X([57:59,61,63:66],:),1);
% Oax 5: Oax 4,7,10
nb(61,:) = mean(X([60,63,66],:),1);
% Oax 6: Oax 3,9,11, Pue 14, Gro 5,6
nb(62,:) = mean(X([59,65,67,221,33,34],:),1);
% Oax 7: Oax 1,4,5, Chis 4,7,10, Ver 14,20
nb(63,:) = mean(X([57,60,61,111,114,16,243,249],:),1);
% Oax 8: Oax 3,4,9
nb(64,:) = mean(X([59,60,65],:),1);
% Oax 9: Oax 3,4,6,8,10,11
nb(65,:) = mean(X([59,60,62,64,66,67],:),1);
% Oax 10: Oax 4,5,9,11
nb(66,:) = mean(X([60,61,65,67],:),1);
% Oax 11: Oax 6,9,10, Gro 5,8
nb(67,:) = mean(X([62,65,66,33,36],:),1);
% Pue 16: Pue 8,13,14,15, Oax 2,3, Ver 15,18
nb(68,:) = mean(X([216,220:222,58,59,244,247],:),1);
% Qro 1: Qro 2,4, Gto 1,2, SLP 3,4,7, Hgo 2
nb(69,:) = mean(X([293,71,132,275,73:75,38],:),1);
% Qro 3: Qro 2,4, Gto 2,14
nb(70,:) = mean(X([293,71,275,140],:),1);
% Qro 4: Qro 1,2,3, Gto 2
nb(71,:) = mean(X([69,293,70,275],:),1);
% SLP 1: SLP 2,3,5, Zac 3,4, NL 9
nb(72,:) = mean(X([226,73,294,299,300,206],:),1);
% SLP 3: SLP 1,2,4,5, NL 9, Tamps 6, Gto 1, Qro 1
nb(73,:) = mean(X([72,226,74,294,206,96,132,69],:),1);
% SLP 4: SLP 3,7, Tamps 6, Ver 1, Qro 1
nb(74,:) = mean(X([73,75,96,233,69],:),1);
% SLP 7: SLP 4, Ver 1,2, Hgo 1,2, Qro 1
nb(75,:) = mean(X([74,233,234,37,38,69],:),1);
% Sin 1: Sin 2,3,4,5, Son 7, Chih 9, Dgo 1
nb(76,:) = mean(X([77:80,90,25,26],:),1);
% Sin 2: Sin 1,4, Son 7
nb(77,:) = mean(X([76,79,90],:),1);
% Sin 3: Sin 1,4,5,7
nb(78,:) = mean(X([76,79,80,82],:),1);
% Sin 4: Sin 1,2,3
nb(79,:) = mean(X(76:78,:),1);
% Sin 5: Sin 1,3,6,7, Dgo 1
nb(80,:) = mean(X([76,78,81,82,26],:),1);
% Sin 6: Sin 5,7,8, Dgo 1, Nay 1
nb(81,:) = mean(X([80,82,83,26,54],:),1);
% Sin 7: Sin 3,5,6
nb(82,:) = mean(X([78,80,81],:),1);
% Sin 8: Sin 6
nb(83,:) = X(81,1);
% Son 1: Son 2,3,4, BC 1
nb(84,:) = mean(X([85:87,102],:),1);
% Son 2: Son 1,4, Chih 1
nb(85,:) = mean(X([84,87,17],:),1);
% Son 3: Son 1,4,5
nb(86,:) = mean(X([84,87,88],:),1);
% Son 4: Son 1,2,3,5,6,7, Chih 1,7
nb(87,:) = mean(X([84:86,88:90,17,23],:),1);
% Son 5: Son 3,4
nb(88,:) = mean(X([86,87],:),1);
% Son 6: Son 4,7
nb(89,:) = mean(X([87,90],:),1);
% Son 7: Son 4,6, Chih 7,9, Sin 1,2
nb(90,:) = mean(X([87,89,23,25,76,77],:),1);
% Tamps 1: Tamps 3, NL 9,12
nb(91,:) = mean(X([93,206,208],:),1);
% Tamps 2: Tamps 3
nb(92,:) = X(93,1);
% Tamps 3: Tamps 1,2,4,5,6, NL 9
nb(93,:) = mean(X([91,92,94:96,206],:),1);
% Tamps 4: Tamps 3
nb(94,:) = X(93,1);
% Tamps 5: Tamps 3,6, NL 9
nb(95,:) = mean(X([93,96,206],:),1);
% Tamps 6: Tamps 3,5,7, NL 9, SLP 3,4, Ver 1
nb(96,:) = mean(X([93,95,97,206,73,74,233],:),1);
% Tamps 7: Tamps 6,8, Ver 1
nb(97,:) = mean(X([96,98,233],:),1);
% Tamps 8: Tamps 7, Ver 1
nb(98,:) = mean(X([97,233],:),1);
% Tlax 1: Tlax 2,3, Hgo 7, Pue 2,7
nb(99,:) = mean(X([100,101,43,210,215],:),1);
% Tlax 2: Tlax 1,3, Pue 6,9
nb(100,:) = mean(X([99,101,214,217],:),1);
% Tlax 3: Tlax 1,2, Pue 5,9,10, Mex 5,38, Hgo 7
nb(101,:) = mean(X([99,100,213,217,218,160,191,43],:),1);
% BC 1: BC 2,3,7, Son 1
nb(102,:) = mean(X([103,104,259,84],:),1);
% BC 2: BC 1,7
nb(103,:) = mean(X([102,259],:),1);
% BC 3: BC 1,7,8, BCS 1
nb(104,:) = mean(X([102,259,107,4],:),1);
% BC 4: BC 5,7,8
nb(105,:) = mean(X([258,259,107],:),1);
% BC 6: BC 5,8
nb(106,:) = mean(X([258,107],:),1);
% BC 8: BC 3,4,5,6,7
nb(107,:) = mean(X([104,105,258,106,259],:),1);
% Col 1: Col 2, Jal 19, Mich 12
nb(108,:) = mean(X([109,156,53],:),1);
% Col 2: Col 1, Jal 18,19, Mich 12
nb(109,:) = mean(X([108,284,156,53],:),1);
% Chis 2: Chis 1,3,4,5,6, Tab 6
nb(110,:) = mean(X([261,14,111:113,232],:),1);
% Chis 4: Chis 2,6,9,10, Tab 2,3,6, Ver 14, Oax 7
nb(111,:) = mean(X([110,113,262,16,229,230,232,243,63],:),1);
% Chis 5: Chis 2,3,6,8
nb(112,:) = mean(X([110,14,113,15],:),1);
% Chis 6: Chis 2,4,5,8,9,10
nb(113,:) = mean(X([110:112,15,262,16],:),1);
% Chis 7: Chis 10,11, Oax 7
nb(114,:) = mean(X([16,115,63],:),1);
% Chis 11: Chis 7,8,10,12
nb(115,:) = mean(X([114,15,16,116],:),1);
% Chis 12: Chis 11
nb(116,:) = X(115,1);
% DF 1: DF 2, Mex 6,8,16,19
nb(117,:) = mean(X([118,161,163,170,172],:),1);
% DF 2: DF 1,6,7,8,9,12, Mex 16,19
nb(118,:) = mean(X([117,263:267,170,172],:),1);
% DF 3: DF 8,10, Mex 19,22
nb(119,:) = mean(X([265,122,172,175],:),1);
% DF 4: DF 19,20,24,25
nb(120,:) = mean(X([125,126,273,130],:),1);
% DF 5: DF 14,21,23,24,25,26
nb(121,:) = mean(X([269,127,129,273,130,131],:),1);
% DF 10: DF 3,8,12,15,16,17, Mex 18,22,24
nb(122,:) = mean(X([119,265,267,124,270,271,171,175,177],:),1);
% DF 11: DF 7,9,13,18, Mex 20,29
nb(123,:) = mean(X([264,266,268,272,173,182],:),1);
% DF 15: DF 10,12,13,16,20,24,26
nb(124,:) = mean(X([122,267,268,270,126,273,131],:),1);
% DF 19: DF 4,18,20,22,25,27, Mex 31,39
nb(125,:) = mean(X([120,272,126,128,130,274,184,192],:),1);
% DF 20: DF 4,13,15,18,19,24
nb(126,:) = mean(X([120,268,124,272,125,273],:),1);
% DF 21: DF 5,14,25,27, Mex 33, Mor 3
nb(127,:) = mean(X([121,269,130,274,186,197],:),1);
% DF 22: DF 19,27, Mex 32,39
nb(128,:) = mean(X([125,274,185,192],:),1);
% DF 23: DF 5,24,26
nb(129,:) = mean(X([121,273,131],:),1);
% DF 25: DF 4,5,19,21,24,27
nb(130,:) = mean(X([120,121,125,127,273,274],:),1);
% DF 26: DF 5,14,15,16,17,23,24, Mex 35
nb(131,:) = mean(X([121,269,124,270,271,129,273,188],:),1);
% Gto 1: Gto 2,3,4, Jal 2, Qro 1, SLP 2,3, Zac 4
nb(132,:) = mean(X([275,133,134,143,69,226,73,300],:),1);
% Gto 3: Gto 1,4,5,6,7, Jal 2
nb(133,:) = mean(X([132,134,135,276,136,143],:),1);
% Gto 4: Gto 1,2,3,7,8,9
nb(134,:) = mean(X([132,275,133,136,277,137],:),1);
% Gto 5: Gto 3,6,7, Jal 2
nb(135,:) = mean(X([133,276,136,143],:),1);
% Gto 7: Gto 3,4,5,6,9,11, Jal 2,3,15
nb(136,:) = mean(X([133:135,276,137,138,143,281,153],:),1);
% Gto 9: Gto 4,7,8,11
nb(137,:) = mean(X([134,136,277,138],:),1);
% Gto 11: Gto 7,8,9,13, Jal 15, Mich 2,5
nb(138,:) = mean(X([136,277,137,139,153,45,48],:),1);
% Gto 13: Gto 8,10,11,12, Mich 2
nb(139,:) = mean(X([277,278,138,279,45],:),1);
% Gto 14: Gto 2,10,12, Mich 2,6, Qro 2,3
nb(140,:) = mean(X([275,278,279,45,49,293,70],:),1);
% Gro 9: Gro 4,8
nb(141,:) = mean(X([280,36],:),1);
% Jal 1: Jal 3,4,6,9,10,12,17,18, Nay 1,3, Zac 2
nb(142,:) = mean(X([281,144,146,149,282,151,155,284,54,56,257],:),1);
% Jal 2: Jal 3, Ags 1,2,3, Gto 1,3,5,7, Zac 2,4
nb(143,:) = mean(X([281,1:3,132,133,135,136,257,300],:),1);
% Jal 4: Jal 1,6,8,9
nb(144,:) = mean(X([142,146,148,149],:),1);
% Jal 5: Jal 18, Nay 3
nb(145,:) = mean(X([284,56],:),1);
% Jal 6: Jal 1,4,8,10,14,16
nb(146,:) = mean(X([142,144,148,282,283,154],:),1);
% Jal 7: Jal 9,11,12,13,16,17
nb(147,:) = mean(X([149:152,154,155],:),1);
% Jal 8: Jal 4,6,9,11,13,14
nb(148,:) = mean(X([144,146,149,150,152,283],:),1);
% Jal 9: Jal 1,4,8,11,17
nb(149,:) = mean(X([142,144,148,150,155],:),1);
% Jal 11: Jal 7,8,9,13,17
nb(150,:) = mean(X([147:149,152,155],:),1);
% Jal 12: Jal 1,7,10,16,17
nb(151,:) = mean(X([142,147,282,154,155],:),1);
% Jal 13: Jal 7,8,11,14,16
nb(152,:) = mean(X([147,148,150,283,154],:),1);
% Jal 15: Jal 3,17, Gto 7,11, Mich 4,5
nb(153,:) = mean(X([281,155,136,138,47,48],:),1);
% Jal 16: Jal 6,7,10,12,13,14
nb(154,:) = mean(X([146,147,282,151,152,283],:),1);
% Jal 17: Jal 1,3,7,9,11,12,15,18,19, Mich 4
nb(155,:) = mean(X([142,281,147,149:151,153,284,156,47],:),1);
% Jal 19: Jal 17,18, Col 1,2, Mich 4,7,12
nb(156,:) = mean(X([155,284,108,109,47,50,53],:),1);
% Mex 2: Mex 1,4,7,28,37, Hgo 3,5
nb(157,:) = mean(X([285,159,162,181,190,39,41],:),1);
% Mex 3: Mex 1,9,23, Mich 3,6, Qro 2
nb(158,:) = mean(X([285,164,176,46,49,293],:),1);
% Mex 4: Mex 1,2,7,9,14,18,
nb(159,:) = mean(X([285,157,162,164,169,171],:),1);
% Mex 5: Mex 10,17,28,38, Hgo 7, Tlax 3
nb(160,:) = mean(X([165,287,181,191,43,101],:),1);
% Mex 6: Mex 8,10,11,16,37, DF 1
nb(161,:) = mean(X([163,165,166,170,190,117],:),1);
% Mex 7: Mex 2,4,8,14,15,37
nb(162,:) = mean(X([157,159,163,169,286,190],:),1);
% Mex 8: Mex 6,7,15,19,37, DF 1
nb(163,:) = mean(X([161,162,286,172,190,117],:),1);
% Mex 9: Mex 1,3,4,18,23,26
nb(164,:) = mean(X([285,158,159,171,176,179],:),1);
% Mex 10: Mex 5,6,11,17,28,37
nb(165,:) = mean(X([160,161,166,287,181,190],:),1);
% Mex 11: Mex 6,10,13,16,17
nb(166,:) = mean(X([161,165,168,170,287],:),1);
% Mex 12: Mex 32,33,38,39, Pue 5
nb(167,:) = mean(X([185,186,191,192,213],:),1);
% Mex 13: Mex 11,16,17,20, DF 6
nb(168,:) = mean(X([166,170,287,173,263],:),1);
% Mex 14: Mex 4,7,15,18,21
nb(169,:) = mean(X([159,162,286,171,174],:),1);
% Mex 16: Mex 6,11,13, DF 1,2,6
nb(170,:) = mean(X([161,166,168,117,118,263],:),1);
% Mex 18: Mex 4,9,14,21,24,26,27,35, DF 10,17
nb(171,:) = mean(X([159,164,169,174,177,179,180,188,122,271],:),1);
% Mex 19: Mex 8,15,22, DF 1,2,3,8
nb(172,:) = mean(X([163,286,175,117:119,265],:),1);
% Mex 20: Mex 13,17,29,38, DF 6,7,11
nb(173,:) = mean(X([168,287,182,191,263,264,123],:),1);
% Mex 21: Mex 14,15,18,22,24
nb(174,:) = mean(X([169,286,171,175,177],:),1);
% Mex 22: Mex 15,19,21,24, DF 3,10
nb(175,:) = mean(X([286,172,174,177,119,122],:),1);
% Mex 23: Mex 3,9,26,34,36,40, Mich 3
nb(176,:) = mean(X([158,164,179,187,189,193,46],:),1);
% Mex 24: Mex 18,21,22, DF 10
nb(177,:) = mean(X([171,174,175,122],:),1);
% Mex 25: Mex 31,38,39
nb(178,:) = mean(X([184,191,192],:),1);
% Mex 26: Mex 9,18,23,27,34
nb(179,:) = mean(X([164,171,176,180,187],:),1);
% Mex 27: Mex 18,26,34,35,40
nb(180,:) = mean(X([171,179,187,188,193],:),1);
% Mex 28: Mex 2,5,10,37, Hgo 3,7
nb(181,:) = mean(X([157,160,165,190,39,43],:),1);
% Mex 29: Mex 20,30,38, DF 11,18
nb(182,:) = mean(X([173,183,191,123,272],:),1);
% Mex 30: Mex 29,31,38, DF 18
nb(183,:) = mean(X([182,184,191,272],:),1);
% Mex 31: Mex 25,30,38,39, DF 18,19
nb(184,:) = mean(X([178,183,191,192,272,125],:),1);
% Mex 32: Mex 12,33,39, DF 22,27
nb(185,:) = mean(X([167,186,192,128,274],:),1);
% Mex 33: Mex 12,32, DF 21,27, Mor 3, Pue 5
nb(186,:) = mean(X([167,185,127,274,197,213],:),1);
% Mex 34: Mex 23,26,27,40
nb(187,:) = mean(X([176,179,180,193],:),1);
% Mex 35: Mex 18,27,40, DF 14,17,26, Mor 1,3,4
nb(188,:) = mean(X([171,180,193,269,271,131,195,197,198],:),1);
% Mex 36: Mex 23,40, Gro 1,2, Mich 3
nb(189,:) = mean(X([176,193,30,31,46],:),1);
% Mex 37: Mex 2,6,7,8,10,28
nb(190,:) = mean(X([157,161:163,165,181],:),1);
% Mex 38: Mex 5,12,17,20,25,29,30,31,39, Tlax 3, Pue 5
nb(191,:) = mean(X([160,167,287,173,178,182:184,192,101,213],:),1);
% Mex 39: Mex 12,25,31,32,38, DF 19,22
nb(192,:) = mean(X([167,178,184,185,191,125,128],:),1);
% Mex 40: Mex 23,27,34,35,36, Gro 2, Mor 4
nb(193,:) = mean(X([176,180,187:189,31,198],:),1);
% Mich 8: Mich 2,7,10,11
nb(194,:) = mean(X([45,50,288,52],:),1);
% Mor 1: Mor 2,3,4, Mex 35
nb(195,:) = mean(X([196:198,188],:),1);
% Mor 2: Mor 1,3,4,5
nb(196,:) = mean(X([195,197:199],:),1);
% Mor 3: Mor 1,2,5, DF 14,21, Mex 33,35, Pue 13
nb(197,:) = mean(X([195,196,199,269,127,186,188,220],:),1);
% Mor 4: Mor 1,2,5, Gro 2,6, Mex 35,40, Pue 14
nb(198,:) = mean(X([195,196,199,31,34,188,193,221],:),1);
% Mor 5: Mor 2,3,4, Pue 13,14
nb(199,:) = mean(X([196:198,220,221],:),1);
% NL 2: NL 3,4,8,12
nb(200,:) = mean(X([201,290,205,208],:),1);
% NL 3: NL 2,4,5,7,12
nb(201,:) = mean(X([200,290,202,204,208],:),1);
% NL 5: NL 3,6,7,12
nb(202,:) = mean(X([201,203,204,208],:),1);
% NL 6: NL 1,5,7,12
nb(203,:) = mean(X([289,202,204,208],:),1);
% NL 7: NL 1,3,4,5,6,8,10
nb(204,:) = mean(X([289,201,290,202,203,205,291],:),1);
% NL 8: NL 2,4,7,10,11,12
nb(205,:) = mean(X([200,290,204,291,207,208],:),1);
% NL 9: NL 1,10,12, Coah 3,4, SLP 1,3, Tamps 1,3,5,6, Zac 3
nb(206,:) = mean(X([289,291,208,9,10,72,73,91,93,95,96,299],:),1);
% NL 11: NL 8,10,12
nb(207,:) = mean(X([205,291,208],:),1);
% NL 12: NL 1,2,3,5,6,8,9,10,11, Coah 1,3, Tamps 1
nb(208,:) = mean(X([289,200:203,205,206,291,207,7,9,91],:),1);
% Pue 1: Pue 2,4, Hgo 4, Ver 2,3,5,6
nb(209,:) = mean(X([210,212,40,234,235,237,238],:),1);
% Pue 2: Pue 1,3,4,7,8, Hgo 4,7, Tlax 1
nb(210,:) = mean(X([209,211,212,215,216,40,43,99],:),1);
% Pue 3: Pue 2,4,8, Ver 6,7,9,13,15
nb(211,:) = mean(X([210,212,216,238,296,240,298,244],:),1);
% Pue 4: Pue 1,2,3, Ver 6
nb(212,:) = mean(X([209:211,238],:),1);
% Pue 5: Pue 10,13, Mex 12,33,38, Tlax 3
nb(213,:) = mean(X([218,220,167,186,191,101],:),1);
% Pue 6: Pue 7,9,11,12, Tlax 2
nb(214,:) = mean(X([215,217,292,219,100],:),1);
% Pue 7: Pue 2,6,8,12,13, Tlax 1
nb(215,:) = mean(X([210,214,216,219,220,99],:),1);
% Pue 8: Pue 2,3,7,13,15,16, Ver 15
nb(216,:) = mean(X([210,211,215,220,222,68,244],:),1);
% Pue 9: Pue 6,10,11, Tlax 2,3
nb(217,:) = mean(X([214,218,292,100,101],:),1);
% Pue 10: Pue 5,9,11,13, Tlax 3
nb(218,:) = mean(X([213,217,292,220,101],:),1);
% Pue 12: Pue 6,7,11,13
nb(219,:) = mean(X([214,215,292,220],:),1);
% Pue 13: Pue 5,7,8,10,11,12,14,16, Mor 3,5
nb(220,:) = mean(X([213,215,216,218,292,219,221,68,197,199],:),1);
% Pue 14: Pue 13,16, Gro 6, Mor 4,5, Oax 3,6
nb(221,:) = mean(X([220,68,34,198,199,59,62],:),1);
% Pue 15: Pue 8,16
nb(222,:) = mean(X([216,68],:),1);
% QR 1: QR 2,3, Yuc 1
nb(223,:) = mean(X([224,225,251],:),1);
% QR 2: QR 1, Camp 1, Yuc 1,5
nb(224,:) = mean(X([223,6,251,255],:),1);
% QR 3: QR 1
nb(225,:) = mean(X(223,:),1);
% SLP 2: SLP 1,3,5,6, Gto 1, Zac 4
nb(226,:) = mean(X([72,73,294,227,132,300],:),1);
% SLP 6: SLP 2,5
nb(227,:) = mean(X([226,294],:),1);
% Tab 1: Tab 4,5,6, Camp 2, Chis 1
nb(228,:) = mean(X([295,231,232,260,261],:),1);
% Tab 2: Tab 3, Chis 4, Ver 11,14
nb(229,:) = mean(X([230,111,297,243],:),1);
% Tab 3: Tab 2,5,6, Chis 4
nb(230,:) = mean(X([229,231,232,111],:),1);
% Tab 5: Tab 1,2,3,6, Camp 2
nb(231,:) = mean(X([228:230,232,260],:),1);
% Tab 6: Tab 1,3,4,5, Chis 1,2,4
nb(232,:) = mean(X([228,230,295,231,261,110,111],:),1);
% Ver 1: Ver 2,3, SLP 4,7, Tamps 6,7,8
nb(233,:) = mean(X([234,235,74,75,96:98],:),1);
% Ver 2: Ver 1,3, Hgo 1,3,4, Pue 1, SLP 7
nb(234,:) = mean(X([233,235,37,39,40,209,75],:),1);
% Ver 3: Ver 1,2,5,6, Pue 1
nb(235,:) = mean(X([233,234,237,238,209],:),1);
% Ver 4: Ver 12,17
nb(236,:) = mean(X([242,246],:),1);
% Ver 5: Ver 3,6, Pue 1
nb(237,:) = mean(X([235,238,209],:),1);
% Ver 6: Ver 3,5,7, Pue 1,3,4
nb(238,:) = mean(X([235,237,296,209,211,212],:),1);
% Ver 8: Ver 7,9,10,13
nb(239,:) = mean(X([296,240,241,298],:),1);
% Ver 9: Ver 7,8,10,13, Pue 3
nb(240,:) = mean(X([296,239,241,298,211],:),1);
% Ver 10: Ver 8,9
nb(241,:) = mean(X([239,240],:),1);
% Ver 12: Ver 4,13,17
nb(242,:) = mean(X([236,298,246],:),1);
% Ver 14: Ver 11,20,21, Chis 4, Oax 7, Tab 2
nb(243,:) = mean(X([297,249,250,111,63,229],:),1);
% Ver 15: Ver 13,16,18, Pue 3,8,16
nb(244,:) = mean(X([298,245,247,211,216,68],:),1);
% Ver 16: Ver 13,15,18
nb(245,:) = mean(X([298,244,247],:),1);
% Ver 17: Ver 4,12,13,18,19,20, Oax 1
nb(246,:) = mean(X([236,242,298,247:249,57],:),1);
% Ver 18: Ver 13,15,16,17, Oax 1, Pue 16
nb(247,:) = mean(X([298,244:246,57,68],:),1);
% Ver 19: Ver 17,20,21
nb(248,:) = mean(X([246,249,250],:),1);
% Ver 20: Ver 14,17,19,21, Oax 1,7
nb(249,:) = mean(X([243,246,248,250,57,63],:),1);
% Ver 21: Ver 11,14,19,20
nb(250,:) = mean(X([297,243,248,249],:),1);
% Yuc 1: Yuc 2,5, QR 1,2
nb(251,:) = mean(X([252,255,223,224],:),1);
% Yuc 2: Yuc 1,3,4,5
nb(252,:) = mean(X([251,253:255],:),1);
% Yuc 3: Yuc 2,4,5
nb(253,:) = mean(X([252,254,255],:),1);
% Yuc 4: Yuc 2,3,5
nb(254,:) = mean(X([252,253,255],:),1);
% Yuc 5: Yuc 1,2,3,4, Camp 1, QR 2
nb(255,:) = mean(X([251:254,6,224],:),1);
% Zac 1: Zac 2,3, Dgo 1,3
nb(256,:) = mean(X([257,299,26,28],:),1);
% Zac 2: Zac 1,3,4, Ags 1, Dgo 1, Jal 1,2,3, Nay 1
nb(257,:) = mean(X([256,299,300,1,26,142,143,281,54],:),1);
% BC 5: BC 4,6,8
nb(258,:) = mean(X(105:107,:),1);
% BC 7: BC 1,2,3,4,8
nb(259,:) = mean(X([102:105,107],:),1);
% Camp 2: Camp 1, Tab 1,5
nb(260,:) = mean(X([6,228,231],:),1);
% Chis 1: Chis 2,3, Tab 1,6
nb(261,:) = mean(X([110,14,228,232],:),1);
% Chis 9: Chis 4,6
nb(262,:) = mean(X([111,113],:),1);
% DF 6: DF 2,7, Mex 13,16,20
nb(263,:) = mean(X([118,264,168,170,173],:),1);
% DF 7: DF 2,6,9,11, Mex 20
nb(264,:) = mean(X([118,263,266,123,173],:),1);
% DF 8: DF 2,3,10,12, Mex 19
nb(265,:) = mean(X([118,119,122,267,172],:),1);
% DF 9: DF 7,11,12,13
nb(266,:) = mean(X([264,123,267,268],:),1);
% DF 12: DF 2,8,9,10,13,15
nb(267,:) = mean(X([118,265,266,122,268,124],:),1);
% DF 13: DF 9,11,12,15,18,20
nb(268,:) = mean(X([266,123,267,124,272,126],:),1);
% DF 14: DF 5,21,26, Mex 35, Mor 3
nb(269,:) = mean(X([121,127,131,188,197],:),1);
% DF 16: DF 10,15,17,26
nb(270,:) = mean(X([122,124,271,131],:),1);
% DF 17: DF 10,16,26, Mex 18,35
nb(271,:) = mean(X([122,270,131,171,188],:),1);
% DF 18: DF 11,13,19,20, Mex 29,30,31
nb(272,:) = mean(X([123,268,125,126,182:184],:),1);
% DF 24: DF 4,5,15,20,23,25,26
nb(273,:) = mean(X([120,121,124,126,129:131],:),1);
% DF 27: DF 19,21,22,25, Mex 32,33
nb(274,:) = mean(X([125,127,128,130,185,186],:),1);
% Gto 2: Gto 1,4,8,12,14, Qro 1,3,4
nb(275,:) = mean(X([132,134,277,279,140,69:71],:),1);
% Gto 6: Gto 3,5,7
nb(276,:) = mean(X([133,135,136],:),1);
% Gto 8: Gto 2,4,9,11,12,13
nb(277,:) = mean(X([275,134,137,138,279,139],:),1);
% Gto 10: Gto 12,13,14, Mich 2
nb(278,:) = mean(X([279,139,140,45],:),1);
% Gto 12: Gto 2,8,10,13,14
nb(279,:) = mean(X([275,277,278,139,140],:),1);
% Gro 4: Gro 7,8,9
nb(280,:) = mean(X([35,36,141],:),1);
% Jal 3: Jal 1,2,15,17, Gto 7, Zac 2
nb(281,:) = mean(X([142,143,153,155,136,257],:),1);
% Jal 10: Jal 1,6,12,16
nb(282,:) = mean(X([142,146,151,154],:),1);
% Jal 14: Jal 6,8,13,16
nb(283,:) = mean(X([146,148,152,154],:),1);
% Jal 18: Jal 1,5,17,19, Col 2, Nay 3
nb(284,:) = mean(X([142,145,155,156,109,56],:),1);
% Mex 1: Mex 2,3,4,9, Hgo 5, Qro 2
nb(285,:) = mean(X([157:159,164,41,293],:),1);
% Mex 15: Mex 7,8,14,19,21,22
nb(286,:) = mean(X([162,163,169,172,174,175],:),1);
% Mex 17: Mex 5,10,11,13,20,38
nb(287,:) = mean(X([160,165,166,168,173,191],:),1);
% Mich 10: Mich 2,3,8,11
nb(288,:) = mean(X([45,46,194,52],:),1);
% NL 1: NL 6,7,9,10,12, Coah 3
nb(289,:) = mean(X([203,204,206,291,208,9],:),1);
% NL 4: NL 2,3,7,8
nb(290,:) = mean(X([200,201,204,205],:),1);
% NL 10: NL 1,7,8,9,11,12
nb(291,:) = mean(X([289,204:208],:),1);
% Pue 11: Pue 6,9,10,12,13
nb(292,:) = mean(X([214,217:220],:),1);
% Qro 2: Qro 1,3,4, Gto 14, Hgo 5, Mex 1,3, Mich 6 
nb(293,:) = mean(X([69:71,140,41,285,158,49],:),1);
% SLP 5: SLP 1,2,3,6
nb(294,:) = mean(X([72,226,73,227],:),1);
% Tab 4: Tab 1,5,6
nb(295,:) = mean(X([228,231,232],:),1);
% Ver 7: Ver 6,8,9, Pue 3
nb(296,:) = mean(X([238:240,211],:),1);
% Ver 11: Ver 14,21, Tab 2
nb(297,:) = mean(X([243,250,229],:),1);
% Ver 13: Ver 8,9,12,15,16,17,18, Pue 3
nb(298,:) = mean(X([239,240,242,244:247,211],:),1);
% Zac 3: Zac 1,2,4, Coah 4,5,7, Dgo 3, NL 9, SLP 1
nb(299,:) = mean(X([256,257,300,10,11,13,28,206,72],:),1);
% Zac 4: Zac 2,3, Ags 1, Gto 1, Jal 2, SLP 1,2
nb(300,:) = mean(X([257,299,1,132,142,72,226],:),1);


